ANDROID: GKI: net: add vendor hooks net qos for gki purpose

Add vendor hooks to support net qos policy feature:

1.android_rvh_tcp_rcv_spurious_retrans
With this hook we could trace the ACK path through the segments which
are spuriously retransmitted by sender.

Bug: 351960112
Bug: 356582738
Bug: 356617512
Bug: 422600631

Change-Id: I739cef428f4a43999d99393a205b3d53a1eb52da
Signed-off-by: Jyu Jiang <jyu.jiang@vivo.corp-partner.google.com>
diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c
index 2e785dc..e574f96 100644
--- a/drivers/android/vendor_hooks.c
+++ b/drivers/android/vendor_hooks.c
@@ -312,6 +312,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_tcp_select_window);
 EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_inet_sock_create);
 EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_inet_sock_release);
 EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_bpf_skb_load_bytes);
+EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_tcp_rcv_spurious_retrans);
 EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_tcp_rtt_estimator);
 EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_udp_enqueue_schedule_skb);
 EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_build_skb_around);
diff --git a/include/trace/hooks/net.h b/include/trace/hooks/net.h
index 54e1dca..b608745 100644
--- a/include/trace/hooks/net.h
+++ b/include/trace/hooks/net.h
@@ -123,6 +123,8 @@ DECLARE_RESTRICTED_HOOK(android_rvh_bpf_skb_load_bytes,
 	TP_PROTO(const struct sk_buff *skb, u32 offset, void *to, u32 len,
 		int *handled, int *err),
 	TP_ARGS(skb, offset, to, len, handled, err), 1);
+DECLARE_RESTRICTED_HOOK(android_rvh_tcp_rcv_spurious_retrans,
+	TP_PROTO(struct sock *sk), TP_ARGS(sk), 1);
 DECLARE_HOOK(android_vh_tcp_rtt_estimator,
 	TP_PROTO(struct sock *sk, long mrtt_us), TP_ARGS(sk, mrtt_us));
 DECLARE_HOOK(android_vh_udp_enqueue_schedule_skb,
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 65b3586..3da69dc 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -4700,6 +4700,8 @@ static void tcp_rcv_spurious_retrans(struct sock *sk, const struct sk_buff *skb)
 	 * repathing due to our own RTO, then rehash the socket to repath our
 	 * packets.
 	 */
+	 trace_android_rvh_tcp_rcv_spurious_retrans(sk);
+
 #if IS_ENABLED(CONFIG_IPV6)
 	if (inet_csk(sk)->icsk_ca_state != TCP_CA_Loss &&
 	    skb->protocol == htons(ETH_P_IPV6) &&